package com.example.demo1.temp;

import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.Callable;

/**
 * @author tang
 */
public class LambdaTest3 {
    /**
     *sort排序练习
     */
    @Test
    public void test1(){
        List<Integer> nums = new ArrayList<>();
        nums.add(12);
        nums.add(14);
        nums.add(1);
        nums.add(16);
        nums.add(6);
        Collections.sort(nums,(x,y)->{
            return Integer.compare(x,y);
        });

        for (Integer num : nums) {
            System.out.println(num);
        }
    }
    @Test
    public void test2(){
        String s = stringHandle("hello java8!",x->x.replace(" ",""));
        System.out.println(s);
    }
    //处理字符串
    public String stringHandle(String x,MyStringFormate myStringFormate){
       return myStringFormate.formateString(x);
    }

}
